export const drawer_config = () => {
    const config = {
        show: false,
        title: "用户管理",
        direction: "rtl",
        size: "30%",
        labelWidth: "90px",
        messageBox: {
            status: true,
            title: "提示",
            message: "是否保存当前数据？",
            confirmButtonText: '保存',
            cancelButtonText: '放弃',
            type: 'warning', // success
            confirmEventName: "save",
            cancelEventName: null
        },
        ifSave: true,
        form: [
            {
                key: "userId",
                type: "hidden",
            },
            {key: "userName", type: "text", label: "用户名"},
            {key: "password", type: "text", label: "密码",condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "userId",
                    value: [null]
                }]},
            {key: "nickName", type: "text", label: "姓名"},
            
            {
                key: "sex",
                type: "radio",
                label: "性别",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "sys_user_sex",
            },
            {key: "phonenumber", type: "text", label: "手机号"},
            {key: "email", type: "text", label: "电子邮件"},
            {
                key: "politicalOutlook",
                type: "select",
                label: "政治面貌",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "political_outlook",
            },
            {
                key: "highestEducational",
                type: "select",
                label: "最高学历",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "highest_educational",
            },
            {
                key: "highestMajor",
                type: "select",
                label: "最高学历专业",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "highest_major",
            },
            {
                key: "status",
                type: "radio",
                label: "显示状态",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "sys_normal_disable"
            },
            {key: "remark", type: "textarea", label: "备注", alert: ""},
            {
                key: "deptId",
                type: "treeSelect",
                label: "部门",
                options: [],
                props: {value: "id", label: "label"}
            },
            {
                key: "postIds",
                type: "tree",
                label: "岗位",
                options: [],
                props: {value: "postId", label: "postName"}
            },
            {
                key: "roleIds",
                type: "tree",
                label: "角色",
                options: [],
                props: {value: "roleId", label: "roleName"}
            }
        ],
        //https://github.com/yiminghe/async-validator
        rules: {
            userName: [
                {required: true, message: '请输入角色名称', trigger: 'blur'},
                {min: 2, max: 9, message: '长度需要2-9个汉字', trigger: 'blur'},
            ],
            nickName: [
                {required: true, message: '请输入用户昵称', trigger: 'blur'},
            ],
            password: [
                {required: true, message: '请输入密码', trigger: 'blur'},
            ],
            deptId: [
                {required: true, message: '请选择部门', trigger: 'blur'},
            ]
        }
    }
    return config
}